<!doctype html>
<html ng-app="app">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../build/common/base.css" rel="stylesheet">
<script type="text/javascript" src="../../build/common/base.js"></script>
<script type="text/javascript" src="../../build/common/ngEdit.js"></script>
</head>
<script type="text/javascript">
	var app = angular.module('app', [ 'baseDirective' ]);
	app.controller("ctrl", [ '$scope', 'baseService',
			function($scope, baseService) {

			} ]);

	/* 获取URL表单的 JSON 数据  必须以 getData为方法名*/
	function getData() {
		return AngularUtil.getScope().data;
	}
	/* 获取URL表单的校验情况，必须以isValid 为方法名 */
	function isValid() {
		//校验表单 ab-validate的 校验
		if (!ngUtil.getScope().form.$valid) {
			$.Dialog.error("表单校验不通过！");
			return false;
		}

		// 您可以自由的去做特殊业务逻辑的校验
		if (!ngUtil.getScope().data.name) {
			$.Dialog.error("商品名称不可为空！");
			return false;
		}
		return true;
	}
	
</script>
<body class="panel success" ng-controller="ctrl">
	<!-- 顶部按钮 -->
	<div class="panel-heading">
		<a class="btn btn-primary fa-save" ng-model="data"  ab-save="/crm/goods/save"> 保存 </a>
		<a href="javascript:void(0)" class="btn btn-sm btn-primary fa-reply" onclick="javascript:$.Dialog.close(window);"> 返回 </a>
	</div>
	<!--  ab-load 去controller 层获取业务数据  -->
	<form name="form" method="post" ab-load="crm/goods/get?id={id}"
		ng-model="data">

		<table class="form-table">
			<tbody>
				<tr>
					<th>商品名称</th>
					<td><input type="text" class=" form-control"
						ng-model="data.name"
						desc="商品名称" ab-validate="{&quot;required&quot;:true}" /></td>
				</tr>
				<tr>
					<th>商品价格</th>
					<td><input type="text" class=" form-control"
						ng-model="data.price"
						desc="商品价格" ab-validate="{'number':true}" /></td>
				</tr>
				<tr>
					<th>商品积分</th>
					<td><input type="text" class=" form-control"
						ng-model="data.credit" 
						desc="商品积分" ab-validate="{'required':true,'digits':true}" /></td>
				</tr>
				<tr>
					<th>商品图片</th>
					<td><a href="javascript:void(0)"
						class=" btn btn-primary fa-upload" ab-upload=""
						ng-model="data.imgUrl"
						></a></td>
						
				</tr>
				<tr>
					<th>商品库存</th>
					<td><input type="text" class=" form-control"
						ng-model="data.inventory"
						desc="商品库存" ab-validate="{'required':true,'digits':true}" /></td>
				</tr>
				<tr>
					<th>商品介绍</th>
					<td>
						<textarea type="text" class="form-control ng-pristine ng-valid ng-valid-custom-validate" ng-model="data.detail" desc="商品介绍" ab-validate="{}"></textarea>
					</td>
				</tr>
			</tbody>
		</table>
		
		
				
	</form>

</body>
















</html>